#!C:\Python26
# -*- coding: UTF-8 -*-

import queVars
import time

def printFuncDef(inStr):
	print inStr,

queVars.printFunc = printFuncDef

import imp


f, filename, desc = imp.find_module('dMoeScrape', ['Plugins'])
scrape = imp.load_module("dMoeScrape", f, filename, desc)		#Messy hack to do relative imports

import webFunctions


queVars.printToStdout = True

import logmanager

logmanager.initLogging()

scr = scrape.getDMoe()


scr.testing = True



if scr.retrievalHandles > 1:
	print "Retrieval Handles - ", scr.retrievalHandles
	handle = []
	for x in range(scr.retrievalHandles):
		handle.append(webFunctions.WebGetRobust())

elif scr.retrievalHandles == 1:
	testpgh = open("Doujin-moe-test4.html", "r")
	testPage = testpgh.read()
	testpgh.close()
	handle = webFunctions.WebGetRobust()#(test=testPage)


config = queVars.ConfigValues()
config.ovwMode = "Check Files"
config.nSrcMode = "All Archives"

config.aList = []

scr.config = config
scr.getHandles = handle

#scr.DLFolder 	= r"N:\Scripts\Downloads\Pixiv"

#config.aList = []
#print scr.getpic(link, name)


print scr.main(config, handle)

#print scr.getPage("http://sbjorkkco89.members.doujin-moe.us/members/index.php?page=galleries&dir=H-Magazine Chapters%2FThe Way of the Ninja (English)%2F")






